package com.atguigu1.one;

import java.util.Scanner;

/**
 * ClassName: arrayExer
 * Package: com.atguigu1.one
 * Description:
 *
 * @Author BuTang
 * @Create 2023/2/22 23:04
 * @Version 1.0
 */
public class arrayExer {
    public static void main(String agrs[]){
        Scanner scan = new Scanner(System.in);
        //定义两个数组
        System.out.print("请输入学生的个数");
        int num = scan.nextInt();
        String[] name = new String[num];
        int[] grade = new int[num];
        int num1 = 0;
        int scoresMax = grade[0];

        //输入循环
        for (int i = 0; i < num ;i++){
            System.out.print("请输入学生姓名");
            name[i] = scan.next();
            System.out.print("请输入学生的成绩");
            grade[i] =  scan.nextInt();

            //比较循环
            if (grade[i]> scoresMax){
                scoresMax = grade[i];
                num1 = i ;

            }
        }

        //输出最大值
        System.out.print("成绩最高的是"+ name[num1]);
        System.out.println("最高的成绩是"+scoresMax);
        for (int i = 0; i < num; i++) {
            System.out.print(name[i]);
            System.out.println(grade[i]+'\n');
        }


    }
}
